package com.xk.exception;


import com.xk.enums.AppHttpCodeEnum;

/**
 *自定义系统异常类
 */
public class SystemException extends RuntimeException{
    /**异常状态码
     *
     */
    private int code;
    /**异常信息
     */
    private String msg;

    /**
     * 获取异常状态码
     * @return 异常状态码
     */
    public int getCode() {
        return code;
    }

    /**
     * 获取异常信息
     * @return 异常信息
     */
    public String getMsg() {
        return msg;
    }

    /**
     * 构造函数，根据 AppHttpCodeEnum 异常状态码枚举生成异常实例
     * @param httpCodeEnum 异常状态码枚举
     */
    public SystemException(AppHttpCodeEnum httpCodeEnum) {
        super(httpCodeEnum.getMsg());
        this.code = httpCodeEnum.getCode();
        this.msg = httpCodeEnum.getMsg();
    }

}
